<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>

<script>
	$(function () {
		$("#team").change(function () {
			$.get("/customerservlet?method=findEmplist",{"teamId":$("#team").val()},function(data){
				data = JSON.parse(data)
				var emp=$("#emp")[0];
				emp.options.length=0;
				$.each(data,function(index,obj){
					emp.options.add(new Option(obj.emp_name,obj.emp_id));
				});
			});
		});
	});
</script>

<div class="pageContent">
	<form method="post" action="/customerservlet?method=doUpdate" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
		<div class="pageFormContent" layoutH="56">
			<input type="hidden" name="cusId" value="${customer.cus_id }"/>
			<p>
				<label>客户名称：</label>
				<input name="cusName" class="required" type="text" size="30" value="${customer.cus_name }"/>
			</p>
			<p>
				<label>客户年龄：</label>
				<input name="cusAge" class="required" type="text" size="30" value="${customer.cus_age }"/>
			</p>
			<p>
				<label>客户联系方式：</label>
				<input name="tel" class="required" type="text" size="30" value="${customer.tel }"/>
			</p>
			<p>
				<label>客户地址：</label>
				<input name="cusLocation" class="required" type="text" size="30" value="${customer.cus_location }"/>
			</p>
			<p>
				<label>客户公司：</label>
				<input name="cusCompany" class="required" type="text" size="30" value="${customer.cus_company }"/>
			</p>
			<p>
				<label>客户职位：</label>
				<input name="cusPosition" class="required" type="text" size="30" value="${customer.cus_position }"/>
			</p>

			<p>
				<label>客户归属团队：</label>
				<select id="team" name="teamId">
					<option value="${customer.team.team_id }" selected="selected">${customer.team.team_name }</option>
					<c:forEach items="${teamlist }" var="team">
						<option value="${team.team_id }">${team.team_name }</option>
					</c:forEach>
				</select>
			</p>

			<p>
				<label>客户归属人：</label>
				<select id="emp" name="empId">
					<option value="${customer.emp.emp_id }" selected="selected">${customer.emp.emp_name }</option>

				</select>
			</p>

			<p>
				<label>客户类型：</label>
				<select name="cusTypeId">
					<option value="${customer.custype.cus_type_id }" selected="selected">${customer.custype.cus_type }</option>
					<c:forEach items="${typelist }" var="custype">
						<option value="${custype.cus_type_id }">${custype.cus_type }</option>
					</c:forEach>
				</select>
			</p>
			<p>
				<label>客户状态：</label>
				<select name="stateId">
					<option value="${customer.cusstate.state_id }" selected="selected">${customer.cusstate.state_name }</option>
					<c:forEach items="${statelist }" var="cusstate">
						<option value="${cusstate.state_id }">${cusstate.state_name }</option>
					</c:forEach>
				</select>
			</p>
			<p>
				<label>客户标签：</label>
				<select name="tagId">
					<option value="${customer.custag.tag_id }" selected="selected">${customer.custag.tag_name }</option>
					<c:forEach items="${taglist }" var="custag">
						<option value="${custag.tag_id }">${custag.tag_name }</option>
					</c:forEach>
				</select>
			</p>


		</div>
		<div class="formBar">
			<ul>
				<!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
		</div>
	</form>
</div>

